import App from './App'
import {
    router,
    RouterMount
} from '@/router/index.js'

import routerLInk from '@/router/link.vue'
Vue.component('RouterLink1', routerLInk)

Vue.use(router)

// 对象
import config from '@/static/js/config.js';
Vue.prototype.$config = config;

import functions from '@/static/js/functions.js';
Vue.prototype.$functions = functions;

import request from '@/static/js/request.js';
Vue.prototype.$request = request;

import $ from "@/static/js/jquery.min.js";
Vue.prototype.$ = $;

// 组件
import navBar from '@/components/navbar/navBar.vue';
Vue.component('navBar', navBar);

import rfSwipeDot from '@/components/rf-swipe-dot';
Vue.component('rf-swipe-dot', rfSwipeDot);

import header from '@/pages/common/header.vue';
Vue.component('dfHeader', header);

import footer from '@/pages/common/footer.vue';
Vue.component('dfFooter', footer);

import loading from '@/pages/common/loading.vue';
Vue.component('dfLoading', loading);

import dfForm from '@/pages/common/form.vue';
Vue.component('dfForm', dfForm);

import dfFormPhone from '@/pages/common/form_phone.vue';
Vue.component('dfFormPhone', dfFormPhone);

//———— 函数
// 初始化cache
functions.getCache("phoneVerify")
// 设置主页参数
functions.setIndexData();


// 根据vue版本进行加载
// #ifdef VUE2
console.log('vue2');
import Vue from 'vue'
Vue.config.productionTip = false
App.mpType = 'app'
const app = new Vue({
    ...App
})
//v1.3.5起 H5端 你应该去除原有的app.$mount();使用路由自带的渲染方式
// #ifdef H5
console.log('h5');
RouterMount(app, router, '#app')
// #endif
// #ifndef H5
console.log('app');
app.$mount(); //为了兼容小程序及app端必须这样写才有效果
// #endif
// #endif

// #ifndef VUE2
import {
    createSSRApp
} from 'vue'
export function createApp() {  
  const app = createSSRApp(App)  
  return {
        app
    }
}
// #endif
